<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;

class UserController extends Controller
{
    public function index()
    {
        $users = User::latest('created_at')->Paginate(8);
        return view('user.user',compact('users'));
    }

    public function destroy($id)
    {
        User::destroy($id);
        session()->flash('success', '删除成功');
        return redirect()->route('userList');
    }
}
